#include <bits/stdc++.h>
// 2025/03/08
// tag:
// Author: Forever
using namespace std;
#pragma GCC optimize(3)
#define int long long

void solve()
{
    int n;
    string s;
    cin >> n >> s;
    int x = count(s.begin(), s.end(), '-');
    cout << (x / 2) * (x - x / 2) * (n - x) << endl;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while (t--)
        solve();
    return 0;
}